package cuiyt.leetcode.dichotomy.demob;

/**
 * @author cyt
 * @create 2020-09-06 16:18
 */
public class Tb {
    public static void main(String[] args) {

    }

    boolean isBadVersion(int x) {
        return false;
    }

    public int firstBadVersion(int n) {
        int cnt = 1;
        while (cnt <= n) {
            int mid = cnt + (n - cnt) / 2;
            boolean version = isBadVersion(mid);
            if (version) {
                n = mid - 1;
            } else {
                cnt = mid + 1;
            }
        }
        return cnt;
    }
}
